package com.example.shop_2305.adapter

import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.ToastUtils
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.lib_base.entity.Child
import com.example.shop_2305.R
import com.example.shop_2305.utils.GlideUtils

class ChildAdapter:BaseQuickAdapter<Child,BaseViewHolder>(R.layout.item_catetwo_child) {
    override fun convert(holder: BaseViewHolder, item: Child) {
        holder.setText(R.id.child_tv,item.name)
        GlideUtils.loadNormal(context,item.extra,holder.getView(R.id.child_iv))
        //添加点击事件
        holder.itemView.setOnClickListener {
            ToastUtils.showLong("点击了${item.name}编号是${item.id}")
            ARouter.getInstance().build("/app/SearchActivity").navigation()
        }
    }
}